package com.test.finkcdc.util;

import com.test.finkcdc.entity.JsonRecord;
import org.apache.flink.streaming.api.functions.ProcessFunction;
import org.apache.flink.util.Collector;
import org.apache.flink.util.OutputTag;

import java.util.Map;

public class OutputTableProcessFunc extends ProcessFunction<JsonRecord,Object> {
    private final Map<String, OutputTag<JsonRecord>> map;
    public OutputTableProcessFunc(Map<String, OutputTag<JsonRecord>> map){
        this.map=map;
    }
    public void processElement(JsonRecord jsonRecord, ProcessFunction<JsonRecord, Object>.Context ctx, Collector<Object> collector) throws Exception {
        ctx.output(map.get(jsonRecord.getTableName()),jsonRecord);
    }
}
